$(function () {
  let ul = $('.info_span1_list')
  let right = $('.info_btn_right')
  let left = $('.info_btn_left')
  let index = 0
  let timer = null
  let box = $('.info_btn')
  timer = setInterval(function () {
    if (index < 2) {
      index++
      play()
    } else {
      index = -1
    }
  }, 3000)
  right.click(function () {
    if (index < 2) {
      index++
      play()
    }
  })
  left.click(function () {
    if (index > 0) {
      index--
      play()
    }
  })
  box.hover(function () {
    clearInterval(timer)
  }, function () {
    timer = setInterval(function () {
      if (index < 2) {
        index++
        play()
      } else {
        index = -1
      }
    }, 3000)
  })
  function play() {
    ul.animate({
      left: -978 * index
    })
  }
})